<template>
  <header class="site-header clearfix" :class="headIos?'side-fixed-ios':'side-fixed'">
    <a v-if="goBack" href="javascript:;" @click="$router.go(-1)" class="go-back">
      <i></i>
    </a>
    <a href="javascript:;" v-if="rightTitle" @click='clickMore(rightTitle)' class="go-back go-new">
      {{rightTitle}}
    </a>
    <h1 >{{headTitle}}</h1>
  </header>
</template>

<script>
    export default {
        data () {
            return {
              headIos:false
            }
        },
      created: function () {
//      || window.navigator.userAgent.indexOf('LBLSIOS') > -1
//      window.navigator.userAgent.indexOf('innjiaAppAndroid') > -1
        if (window.navigator.userAgent.indexOf('LBLSIOS') > -1){
          this.headIos = true
        }else {
          this.headIos = false
        }
      },
      props:['headTitle','goBack','rightTitle'],
      methods:{
        clickMore:function (val) {
          this.$emit('rightClick',val)//发布订阅模式
        }
      }
    }

</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .site-header{
    height: 45px;
    line-height: 45px;
    background: #fff;
    border-bottom: 1px solid #dedede;
  }
  .site-header .go-back{
    float: left;
    width: 14.06%;
    height: 45px;
    font-size: 14px;
    color: #212121;
  }
  .site-header .go-back i {
    display: block;
    width: 16px;
    height: 16px;
    margin-top: 15px;
    margin-left: 15px;
    background-image: url(../../assets/img/arrow-l.png);
    background-repeat: no-repeat;
    -webkit-background-size: contain;
    background-size: contain;
  }
  .site-header h1 {
    margin-left: 14.06%;
    margin-right: 14.06%;
    font-size: 18px;
    text-align: center;
    margin-bottom: 0;
    margin-top: 0;
    font-weight: normal;
  }
  .go-new {
    float: right !important;
    color:  #212121 !important;
    text-align: center;
  }
  .side-fixed {
    width: 100%;
    position: fixed;
    top: 0;
    z-index: 499;
  }
  .side-fixed-ios {
    width: 100%;
    position: fixed;
    top: 20px;
    z-index: 499;
  }
  @media screen and (max-width: 320px) {
    .go-new{
      width: 22% !important;
    }
  }
  @media screen and (min-width: 320px) and (max-width: 500px){
    .go-new{
      width: 20% !important;
    }
  }
</style>
